<html>
<head><meta charset="utf-8"><title>rlib-intermediate-object-reuse · t-cargo · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/index.html">t-cargo</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html">rlib-intermediate-object-reuse</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="225653640"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/225653640" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Leo Le Bouter <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#225653640">(Feb 09 2021 at 07:38)</a>:</h4>
<p>hello! I am a GNU Guix contributor and we are packaging Rust inside GNU Guix and we would like to cache intermediate artifacts after compilation. We currently package individual libraries but we only serve source code. We would like to serve built artifact for each of these binaries instead of building everything again at each use of these libraries. I know .rlib files are affected by compiler version and many rustc parameters. Given these are identical how can we reuse .rlib in a supported/stable/easy way? Thank you!</p>



<a name="225657062"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/225657062" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#225657062">(Feb 09 2021 at 08:29)</a>:</h4>
<p><span class="user-mention" data-user-id="214522">@Leo Le Bouter</span> If the rustc version and the arguments to rustc are identical you can just copy the rlib file. If you are using cargo, you will need to also copy the <code>.d</code> file and ensure that the mtime is identical to ensure that cargo doesn't think it is outdated. Do now that many crates enable different cargo features for dependencies. Cargo takes the union of all required features for a dependency, so adding a crate may cause something seemingly unrelated to be rebuilt as it gets a new feature enabled. You of course also need to ensure that the same crate version is used for reuse to be possible.</p>



<a name="225657867"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/225657867" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Leo Le Bouter <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#225657867">(Feb 09 2021 at 08:39)</a>:</h4>
<p><span class="user-mention" data-user-id="133247">@bjorn3</span> Thank you, is it possible to disable mtime checking? Or if you have experience with the source code, maybe you can tell me what it's called inside there, struct/function/file name that handles these things.</p>



<a name="225657998"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/225657998" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#225657998">(Feb 09 2021 at 08:40)</a>:</h4>
<p>No, I don't think so. Someone was working on hash based checking as fallback for mtime: <a href="https://github.com/rust-lang/cargo/issues/8623">rust-lang/cargo#8623</a> It has been over a month since the last update on it though.</p>



<a name="225658068"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/225658068" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Leo Le Bouter <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#225658068">(Feb 09 2021 at 08:41)</a>:</h4>
<p>Thanks</p>



<a name="225658296"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/225658296" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Leo Le Bouter <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#225658296">(Feb 09 2021 at 08:44)</a>:</h4>
<p><span class="user-mention" data-user-id="133247">@bjorn3</span> I notice there are paths that reference the source directory in <code>.d</code> files, how exactly does cargo check those? Is it important if that path exists?</p>



<a name="225658352"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/225658352" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Leo Le Bouter <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#225658352">(Feb 09 2021 at 08:45)</a>:</h4>
<p>If I copy <code>.d</code> and <code>.rlib</code> files from one target directory to another, will it reuse compilation artifacts if same compiler/parameters/features/mtime?</p>



<a name="225658449"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/225658449" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#225658449">(Feb 09 2021 at 08:46)</a>:</h4>
<p>Cargo checks that the mtime of all dependencies is before the mtime of the compiled artifacts as far as I know. The paths do have to exist, but the source and target dir are allowed to be moved.</p>



<a name="225829468"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/225829468" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> John Soo <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#225829468">(Feb 10 2021 at 12:39)</a>:</h4>
<p><span class="user-mention" data-user-id="133247">@bjorn3</span> What should guix be aware of as far as features go? In general, guix’ packaging model is like another distro’s in that we want to provide system packages</p>



<a name="225829604"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/225829604" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> John Soo <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#225829604">(Feb 10 2021 at 12:40)</a>:</h4>
<p>Guix does use cargo and will always reset mtime to the Unix epoch for reproducibility</p>



<a name="225829705"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/225829705" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#225829705">(Feb 10 2021 at 12:41)</a>:</h4>
<p>Some crates use mutually exclusive features. While officially features are strictly additive, these crates need to for example switch between two backends and use mutually exclusive features for that.</p>



<a name="225829909"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/225829909" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> John Soo <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#225829909">(Feb 10 2021 at 12:43)</a>:</h4>
<p>Is there any way to provide the union of all features from a system package and have consumers of the crate choose those features when they compile? Also, does this overlap with incr-comp?</p>



<a name="225830162"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/225830162" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#225830162">(Feb 10 2021 at 12:45)</a>:</h4>
<p>No, crates are always compiled with a specific feature set. It is not possible to compile with all and then let downstream users magically pick just the parts for a specific feature.</p>



<a name="225830544"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/225830544" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> John Soo <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#225830544">(Feb 10 2021 at 12:48)</a>:</h4>
<p>I see. I’ve been thinking about what would be required to support functional package managers better in cargo and rustc. I feel like there are fruitful ways to collaborate between guix/nix and rust. I’m happy to put in some work to make it happen. What would you say would be the best way to begin a more formal relationship?</p>



<a name="225830752"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/225830752" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#225830752">(Feb 10 2021 at 12:50)</a>:</h4>
<p>I am not quite sure. You may want to talk to someone on the cargo team: <a href="https://github.com/rust-lang/team/blob/77c98b7de2b26a1592713d1b4ac7df2e8030304f/teams/cargo.toml#L4-L11">https://github.com/rust-lang/team/blob/77c98b7de2b26a1592713d1b4ac7df2e8030304f/teams/cargo.toml#L4-L11</a></p>



<a name="225830950"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/225830950" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> John Soo <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#225830950">(Feb 10 2021 at 12:52)</a>:</h4>
<p>I see. Is Zulip the preferred discussion tool to speak with them?</p>



<a name="225831080"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/225831080" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#225831080">(Feb 10 2021 at 12:53)</a>:</h4>
<p>I think so, but it may also be the official rust discord.</p>



<a name="225831430"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/225831430" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> John Soo <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#225831430">(Feb 10 2021 at 12:56)</a>:</h4>
<p>I’m very nervous about pinging someone directly!</p>



<a name="225835462"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/225835462" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#225835462">(Feb 10 2021 at 13:31)</a>:</h4>
<p>Hi! You are in the correct place. This is where the Cargo team chats.</p>



<a name="225835793"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/225835793" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#225835793">(Feb 10 2021 at 13:34)</a>:</h4>
<p>We would love to work with you to make Cargo better for your use case.</p>



<a name="225836667"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/225836667" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#225836667">(Feb 10 2021 at 13:41)</a>:</h4>
<p>As far as features are concnerned, you're probably best off by considering dependencies of a given crate as a potentially unique package. As in, even if crate <code>apple</code> depends on <code>peach</code> and you have some build of <code>peach</code> in store already, you would still need to consider <code>peach</code> as entirely independent package for the purposes of building <code>banana</code>.</p>



<a name="225836774"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/225836774" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#225836774">(Feb 10 2021 at 13:42)</a>:</h4>
<p>this also is relevant for crate duplication when satisfying version constraints. A crate <code>chaenomeles</code> may link to both <code>peach 0.1</code> and <code>peach 1.0</code> at various points in the dependency graph, for example.</p>



<a name="225837187"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/225837187" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#225837187">(Feb 10 2021 at 13:45)</a>:</h4>
<p>In practice you should get pretty good results by generating package definitions from <code>cargo metadata</code> output.</p>



<a name="225837284"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/225837284" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#225837284">(Feb 10 2021 at 13:46)</a>:</h4>
<p>That's what many nix-related projects do. Rust-Bazel integration too, I believe.</p>



<a name="225896216"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/225896216" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#225896216">(Feb 10 2021 at 19:44)</a>:</h4>
<p><span class="user-mention" data-user-id="316408">@John Soo</span> You might take a look at what Debian and other distributions do with Rust features.</p>



<a name="225896307"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/225896307" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#225896307">(Feb 10 2021 at 19:44)</a>:</h4>
<p>I built the initial design for Rust packaging in Debian (though others now maintain it). Each feature (and the dependencies of that feature) gets a different "package", to make dependency resolution work well.</p>



<a name="225896328"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/225896328" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#225896328">(Feb 10 2021 at 19:45)</a>:</h4>
<p>That's not addressing the "pre-compiled" issue, though.</p>



<a name="225896413"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/225896413" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#225896413">(Feb 10 2021 at 19:45)</a>:</h4>
<p>Does guix need <em>every</em> package to be "pre-compiled", or can it determine on the fly "I have a pre-compiled package for this" versus "I don't have a pre-compiled package so I'll have to build this"?</p>



<a name="225896573"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/225896573" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#225896573">(Feb 10 2021 at 19:46)</a>:</h4>
<p>If the latter, then you could arrange for source-based packages that get built by things that depend on them, and then provide pre-compiled versions for crate/feature combinations that many other packages depend on.</p>



<a name="225903918"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/225903918" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> John Soo <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#225903918">(Feb 10 2021 at 20:38)</a>:</h4>
<p>It would be preferrable to be able to define packages for auditing and de-vendoring. For guix this is particularly important since it must meet FSDG requirements. I'm afraid generating package definitions just isn't going to work for guix. Nix may be different on that point. It is arguably not an ideal situation. Functional package management should help with rust's reproducibility and incremental compilation.</p>



<a name="225904111"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/225904111" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> John Soo <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#225904111">(Feb 10 2021 at 20:40)</a>:</h4>
<p>Guix always builds everything from source, currently. I would love to look at the way debian does it. Is there a quick link I should check out?</p>



<a name="225905990"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/225905990" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#225905990">(Feb 10 2021 at 20:53)</a>:</h4>
<p>Ah, if guix builds everything from source, that'll be much easier then.</p>



<a name="225906045"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/225906045" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#225906045">(Feb 10 2021 at 20:53)</a>:</h4>
<p><a href="https://wiki.debian.org/Teams/RustPackaging/Policy">https://wiki.debian.org/Teams/RustPackaging/Policy</a></p>



<a name="225906170"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/225906170" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#225906170">(Feb 10 2021 at 20:54)</a>:</h4>
<p>A Rust crate <code>xyz</code> becomes a Debian package <code>librust-xyz-dev</code>, which installs its source code into a directory registry.</p>



<a name="225906273"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/225906273" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#225906273">(Feb 10 2021 at 20:55)</a>:</h4>
<p>The Rust feature <code>abc</code> of crate <code>xyz</code> becomes a package <code>librust-xyz+abc-dev</code>, which adds any additional dependencies for that feature, including on other crate feature packages.</p>



<a name="225906519"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/225906519" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#225906519">(Feb 10 2021 at 20:56)</a>:</h4>
<p>Then you just need a tool that takes a crate <code>xyz</code> and turns it into a package of that crate's source, together with the packaging metadata.</p>



<a name="225906579"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/225906579" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#225906579">(Feb 10 2021 at 20:57)</a>:</h4>
<p>When you want to package something, you package/update its dependencies recursively.</p>



<a name="225906690"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/225906690" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#225906690">(Feb 10 2021 at 20:58)</a>:</h4>
<p>And the translation tool takes the dependencies from the Cargo manifest and turns them into dependencies in your native metadata.</p>



<a name="225906721"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/225906721" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#225906721">(Feb 10 2021 at 20:58)</a>:</h4>
<p>Does that sound potentially reasonable?</p>



<a name="225911670"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/225911670" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#225911670">(Feb 10 2021 at 21:33)</a>:</h4>
<p>what  I meant by generating is generating the package definitions ahead of time in the first place and then checking them in, rather than generating packages at evaluation time (in nix's parlance). even debian does it afaik, because its untenable to package crates otherwise.</p>



<a name="225911867"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/225911867" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#225911867">(Feb 10 2021 at 21:34)</a>:</h4>
<p>the features cause a combinatorial explosion, pretty much.</p>



<a name="226045617"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226045617" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Leo Le Bouter <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226045617">(Feb 11 2021 at 19:33)</a>:</h4>
<p>The first features we would need for GNU Guix are, a way to disable checksum generation and checking on sources (because GNU Guix already checks everything on its own and has authority for what's good and what's not), then a way to build dynamic/static libraries of Rust crates (also delaying feature selection and others, for dependent crates to be able pick features they need when they are compiled against the static library or load the dynamic library.).</p>



<a name="226045695"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226045695" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Leo Le Bouter <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226045695">(Feb 11 2021 at 19:33)</a>:</h4>
<p>We already monkey-patch checksums automatically as a way to workaround checksum checking</p>



<a name="226046043"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226046043" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Leo Le Bouter <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226046043">(Feb 11 2021 at 19:35)</a>:</h4>
<p>The best would be that all crates can be compiled to .so files with feature selection delayed at load time and a stable ABI for each compiler version. (We recompile everything if the compiler changes anyway).</p>



<a name="226046307"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226046307" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Leo Le Bouter <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226046307">(Feb 11 2021 at 19:37)</a>:</h4>
<p>This way everything is the most size-efficient possible, instead of copying machine code in every resulting library.</p>



<a name="226046441"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226046441" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Leo Le Bouter <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226046441">(Feb 11 2021 at 19:38)</a>:</h4>
<p>We understand the performance hit that could cause due to missed optimizations, but I don't think it matters for us right now.</p>



<a name="226046499"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226046499" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226046499">(Feb 11 2021 at 19:38)</a>:</h4>
<p>But build scripts can generate different code depending on features.</p>



<a name="226046606"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226046606" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Leo Le Bouter <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226046606">(Feb 11 2021 at 19:39)</a>:</h4>
<p>Maybe it's possible to find a way to embed all the different compilation results with different features.</p>



<a name="226046700"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226046700" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Steven Fackler <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226046700">(Feb 11 2021 at 19:40)</a>:</h4>
<p>Those libraries would be exponentially large in the number of features</p>



<a name="226046727"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226046727" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226046727">(Feb 11 2021 at 19:40)</a>:</h4>
<p>Build scripts can do arbitrarily complex things.</p>



<a name="226047082"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226047082" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Leo Le Bouter <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226047082">(Feb 11 2021 at 19:43)</a>:</h4>
<p><span class="user-mention" data-user-id="243558">@Steven Fackler</span> Maybe some kind of optimization to only embed parts of machine code that changed, and not duplicate everything?</p>



<a name="226047147"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226047147" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Steven Fackler <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226047147">(Feb 11 2021 at 19:43)</a>:</h4>
<p>Does Guix compile all C libraries with every combination of autoconf flags? I'm not sure why you'd need to do a powerset thing in this case but not that one</p>



<a name="226047244"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226047244" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Leo Le Bouter <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226047244">(Feb 11 2021 at 19:44)</a>:</h4>
<p>Not every combination because it's not necessary, but all of them as dependents require</p>



<a name="226047363"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226047363" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Leo Le Bouter <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226047363">(Feb 11 2021 at 19:45)</a>:</h4>
<p>Packaging Rust things without something to ease it up is really not viable, so I'm no expert but something has to happen I think, unless getting things packaged isnt important after all</p>



<a name="226047464"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226047464" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226047464">(Feb 11 2021 at 19:46)</a>:</h4>
<p>Why is it viable for C but not for Rust?</p>



<a name="226047530"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226047530" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Leo Le Bouter <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226047530">(Feb 11 2021 at 19:46)</a>:</h4>
<p>I think you understand why, I don't feel well in this discussion, see you</p>



<a name="226047573"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226047573" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226047573">(Feb 11 2021 at 19:47)</a>:</h4>
<p>I am sorry.</p>



<a name="226047604"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226047604" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226047604">(Feb 11 2021 at 19:47)</a>:</h4>
<p>I didn't mean to offend.</p>



<a name="226047705"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226047705" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Leo Le Bouter <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226047705">(Feb 11 2021 at 19:48)</a>:</h4>
<p>If we can't agree there is some kind of issue in that area then we do not :-(</p>



<a name="226047817"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226047817" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226047817">(Feb 11 2021 at 19:49)</a>:</h4>
<p>I truly know nothing about packaging C. And so don't understand why it does not have the same problems. I am sorry if I am being obtuse.</p>



<a name="226047984"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226047984" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226047984">(Feb 11 2021 at 19:50)</a>:</h4>
<p>I will bow out of this conversation to allow those with more background to help you. I am sorry.</p>



<a name="226048469"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226048469" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Leo Le Bouter <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226048469">(Feb 11 2021 at 19:54)</a>:</h4>
<p>I felt dismissed by the heart reaction you made on Steven's message, as if you were happy they found something in C/C++ that would basically mean Rust wouldnt have anything to do to ease up packaging in that area because C/C++ would suffer from the same problems and everything was just fine. It's not exactly like that and culturally C/C++ project features are more so additive in practice which makes it easier.</p>



<a name="226048493"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226048493" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Leo Le Bouter <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226048493">(Feb 11 2021 at 19:54)</a>:</h4>
<p>But if that's a misunderstanding we can go on</p>



<a name="226050081"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226050081" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226050081">(Feb 11 2021 at 20:05)</a>:</h4>
<p>Majority of features in crates are additive, but that is only a convention, so for the features that satisfy this property just enabling them would go a long way.</p>



<a name="226050186"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226050186" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226050186">(Feb 11 2021 at 20:06)</a>:</h4>
<p>This convention is strongly recommended by e.g. cargo operation (it e.g. exposes <code>--all-features</code> flag), but not everybody heeds the advice.</p>



<a name="226050304"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226050304" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226050304">(Feb 11 2021 at 20:07)</a>:</h4>
<p>Then they can do an equivalent of </p>
<div class="codehilite"><pre><span></span><code>#ifdef FEATURE_1 &amp;&amp; FEATURE_2
#error &quot;can&#39;t have both&quot;
#endif
</code></pre></div>
<p>And the build would fail. How does Guix deal with C libraries that also have mutually exclusive configurations/defines (I would imagine it just makes an authoritative choice?)?</p>



<a name="226050413"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226050413" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226050413">(Feb 11 2021 at 20:08)</a>:</h4>
<p>Rust/Cargo transparently handling this kind of situation seems pretty hard to implement, AFAICT.</p>



<a name="226050666"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226050666" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226050666">(Feb 11 2021 at 20:10)</a>:</h4>
<p>to the point where just requiring people to have only additive features would be an easier implementation. See <a href="https://github.com/rust-lang/cargo/issues/4328">https://github.com/rust-lang/cargo/issues/4328</a> for the outcome of that.</p>



<a name="226051035"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226051035" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Leo Le Bouter <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226051035">(Feb 11 2021 at 20:13)</a>:</h4>
<p><span class="user-mention" data-user-id="123586">@nagisa</span> I've never seen any C/C++ package do this myself, but it would be dealt with by multiple packages as needed by dependents. I've more so seen Rust crates do it, but the main problem now for me would be that crates do not necessarily expect their dependencies to have all features enabled, while in C/C++ the more are enabled the better it is (in my experience). By that I mean that it being explicit in Rust, some crates may depend on it. While in C/C++ there never was an easy universal ubiquitous tool to express such a requirement, it always was loosely defined.</p>



<a name="226051088"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226051088" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Leo Le Bouter <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226051088">(Feb 11 2021 at 20:14)</a>:</h4>
<p>Thanks for the link will look</p>



<a name="226051200"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226051200" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226051200">(Feb 11 2021 at 20:15)</a>:</h4>
<p>I dont believe personally that the linked issue is resolved, alas.</p>



<a name="226051238"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226051238" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226051238">(Feb 11 2021 at 20:15)</a>:</h4>
<p>well, it was resolved in the sense that cargo recommends making features additive</p>



<a name="226051245"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226051245" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Leo Le Bouter <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226051245">(Feb 11 2021 at 20:15)</a>:</h4>
<p>If that's okay to require features to be additive in all crates it would really help us</p>



<a name="226051246"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226051246" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226051246">(Feb 11 2021 at 20:15)</a>:</h4>
<p>but it's just documentation</p>



<a name="226051278"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226051278" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226051278">(Feb 11 2021 at 20:16)</a>:</h4>
<p><span class="user-mention silent" data-user-id="214522">Leo Le Bouter</span> <a href="#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226051245">said</a>:</p>
<blockquote>
<p>If that's okay to require features to be additive in all crates it would really help us</p>
</blockquote>
<p>for this to work there needs to be some replacement for mutually incompatible features</p>



<a name="226051350"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226051350" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226051350">(Feb 11 2021 at 20:16)</a>:</h4>
<p>this is used a lot for e.g. "which async executor should the crate use"</p>



<a name="226051380"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226051380" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226051380">(Feb 11 2021 at 20:16)</a>:</h4>
<p>"use both" usually leads to compile errors</p>



<a name="226051400"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226051400" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226051400">(Feb 11 2021 at 20:16)</a>:</h4>
<p>but "use neither" also doesn't work</p>



<a name="226051478"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226051478" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Leo Le Bouter <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226051478">(Feb 11 2021 at 20:17)</a>:</h4>
<p>This can be handled in the crate's API, runtime feature checking</p>



<a name="226051509"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226051509" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226051509">(Feb 11 2021 at 20:17)</a>:</h4>
<p>I think that problem would solve itself naturally even without a technical replacement if everybody was encouraged to CI with <code>--all-features</code>.</p>



<a name="226051539"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226051539" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226051539">(Feb 11 2021 at 20:17)</a>:</h4>
<p><span class="user-mention silent" data-user-id="214522">Leo Le Bouter</span> <a href="#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226051478">said</a>:</p>
<blockquote>
<p>This can be handled in the crate's API, runtime feature checking</p>
</blockquote>
<p>well but then you have  to compile both in, which means longer compile times</p>



<a name="226051610"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226051610" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226051610">(Feb 11 2021 at 20:18)</a>:</h4>
<p>We could run a crater compiling all crates with <code>--all-features</code>.</p>



<a name="226051614"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226051614" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226051614">(Feb 11 2021 at 20:18)</a>:</h4>
<p>which probably matters less to GUIX, but matters a lot to developers</p>



<a name="226051640"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226051640" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226051640">(Feb 11 2021 at 20:18)</a>:</h4>
<p><span class="user-mention silent" data-user-id="123586">nagisa</span> <a href="#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226051610">said</a>:</p>
<blockquote>
<p>We could run a crater compiling all crates with <code>--all-features</code>.</p>
</blockquote>
<p>what would be the point? We discover "these 5000 crates failed to compile"; now what?</p>



<a name="226051678"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226051678" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Leo Le Bouter <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226051678">(Feb 11 2021 at 20:18)</a>:</h4>
<p>Or not, because you can fail at runtime if you don't have the feature enabled for the thing it's asking you to do</p>



<a name="226051752"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226051752" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226051752">(Feb 11 2021 at 20:19)</a>:</h4>
<p>the problem with all of this is it requires a big time investment from the <em>original</em> crate authors</p>



<a name="226051760"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226051760" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226051760">(Feb 11 2021 at 20:19)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226051539">said</a>:</p>
<div class="codehilite"><pre><span></span><code>well but then you have  to compile both in, which means longer compile times
</code></pre></div>
<p>Only when the developers do end up enabling the features for the two separate runtimes would the build times be worse.</p>



<a name="226051765"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226051765" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Leo Le Bouter <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226051765">(Feb 11 2021 at 20:19)</a>:</h4>
<p>Developers could define the features they need tightly while distros could enable everything</p>



<a name="226051773"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226051773" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226051773">(Feb 11 2021 at 20:19)</a>:</h4>
<p>which you're not going to be able to do for every single rust project</p>



<a name="226051930"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226051930" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226051930">(Feb 11 2021 at 20:20)</a>:</h4>
<p>(since I assume you want to spend your time actually packaging thousands of project and not restructing them all to work with <code>--all-features</code>)</p>



<a name="226051974"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226051974" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226051974">(Feb 11 2021 at 20:21)</a>:</h4>
<p>the embedded ecosystem relies heavily on non-additive features; not sure if you want to package those crates though</p>



<a name="226051981"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226051981" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Leo Le Bouter <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226051981">(Feb 11 2021 at 20:21)</a>:</h4>
<p>Debian or GNU Guix people have knowledge and time to patch crates whose author does not want to do anything</p>



<a name="226052017"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226052017" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226052017">(Feb 11 2021 at 20:21)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226051640">said</a>:</p>
<blockquote>
<p>what would be the point? We discover "these 5000 crates failed to compile"; now what?</p>
</blockquote>
<p>I've been reporting the instances where features are not additive and hindered my use of them as they came up. I wouldn't bug the little used crates, but I think there are a couple of avenues to explore once we have the results:</p>
<ol>
<li>File issues with very popular crates;</li>
<li>Write blog posts, guidance;</li>
<li>etc.</li>
</ol>



<a name="226052149"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226052149" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226052149">(Feb 11 2021 at 20:22)</a>:</h4>
<p>Of course having a bot to file 5000 issues is counterproductive, but there are many milder means to guide developers towards fixing the crates they maintain, and I think there's value in knowing how exactly widespread this problem is in the first place.</p>



<a name="226052168"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226052168" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Leo Le Bouter <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226052168">(Feb 11 2021 at 20:22)</a>:</h4>
<p><span class="user-mention" data-user-id="211727">@Jonas Schievink</span> In what way?</p>



<a name="226052238"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226052238" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226052238">(Feb 11 2021 at 20:23)</a>:</h4>
<p>for example to support different microcontrollers, like <a href="https://github.com/nrf-rs/nrf-hal/blob/master/nrf-hal-common/Cargo.toml#L71-L77">here</a></p>



<a name="226052322"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226052322" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226052322">(Feb 11 2021 at 20:24)</a>:</h4>
<p>I don't think this is terribly relevant to packaging in guix, but I wouldn't be surprised if there are crates that you <em>do</em> want to package that can't easily avoid this</p>



<a name="226052391"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226052391" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Leo Le Bouter <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226052391">(Feb 11 2021 at 20:24)</a>:</h4>
<p><span class="user-mention" data-user-id="211727">@Jonas Schievink</span> In the description it says do not use this directly, does it mean you have crates for each microcontroller as well?</p>



<a name="226052409"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226052409" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226052409">(Feb 11 2021 at 20:24)</a>:</h4>
<p>yeah</p>



<a name="226052435"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226052435" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226052435">(Feb 11 2021 at 20:25)</a>:</h4>
<p>but that's a relatively uncommon pattern</p>



<a name="226052500"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226052500" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Leo Le Bouter <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226052500">(Feb 11 2021 at 20:25)</a>:</h4>
<p>I think the pattern also helps us here because it means we can consider each microcontroller feature a single library</p>



<a name="226052743"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226052743" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Leo Le Bouter <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226052743">(Feb 11 2021 at 20:27)</a>:</h4>
<p>I think this kind of usage is fine w.r.t. to packaging</p>



<a name="226052856"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226052856" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Leo Le Bouter <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226052856">(Feb 11 2021 at 20:28)</a>:</h4>
<p>What is the main pain point is inability for crates to use compiled dependents that enable more features than they request for</p>



<a name="226052878"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226052878" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Leo Le Bouter <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226052878">(Feb 11 2021 at 20:28)</a>:</h4>
<p>AIUI</p>



<a name="226052920"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226052920" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226052920">(Feb 11 2021 at 20:28)</a>:</h4>
<p>if the crate compiles with more features added,  I would expect it to work fine that way</p>



<a name="226052926"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226052926" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226052926">(Feb 11 2021 at 20:28)</a>:</h4>
<p>just that some crates may not compile</p>



<a name="226052986"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226052986" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Leo Le Bouter <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226052986">(Feb 11 2021 at 20:29)</a>:</h4>
<p>How can we do that however? Since there's nothing documented to share built artifacts across multiple projects</p>



<a name="226053148"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226053148" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226053148">(Feb 11 2021 at 20:30)</a>:</h4>
<p><a href="#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/225657062">https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/225657062</a></p>



<a name="226053156"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226053156" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Leo Le Bouter <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226053156">(Feb 11 2021 at 20:30)</a>:</h4>
<p>Still could not succeed with re-using .rlib yet, I think it's because of mtime so will have to patch that out from cargo, already did for checksums</p>



<a name="226053784"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226053784" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Leo Le Bouter <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226053784">(Feb 11 2021 at 20:35)</a>:</h4>
<p>Does cargo/rustc check if different set of feature is enabled and if so requires recompilation?</p>



<a name="226053812"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226053812" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226053812">(Feb 11 2021 at 20:35)</a>:</h4>
<p>yes, if the feature set is different cargo will recompile the crate</p>



<a name="226053867"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226053867" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Leo Le Bouter <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226053867">(Feb 11 2021 at 20:36)</a>:</h4>
<p>Is it cargo or rustc?</p>



<a name="226053891"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226053891" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226053891">(Feb 11 2021 at 20:36)</a>:</h4>
<p>I don't understand the question. What do you mean by recompile?</p>



<a name="226053896"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226053896" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Leo Le Bouter <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226053896">(Feb 11 2021 at 20:36)</a>:</h4>
<p>Can I patch that out from cargo easily?</p>



<a name="226054006"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226054006" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Leo Le Bouter <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226054006">(Feb 11 2021 at 20:37)</a>:</h4>
<p>I want to enable all features of a crate in packages and then reuse the .rlib from target directory to compile all crates that depend on it</p>



<a name="226054093"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226054093" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Leo Le Bouter <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226054093">(Feb 11 2021 at 20:38)</a>:</h4>
<p>Whether they only depend on a subset of the features that are enabled or not</p>



<a name="226054147"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226054147" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Leo Le Bouter <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226054147">(Feb 11 2021 at 20:38)</a>:</h4>
<p>For crates that do not work with --all-features then we will create multiple packages</p>



<a name="226054287"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226054287" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Leo Le Bouter <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226054287">(Feb 11 2021 at 20:40)</a>:</h4>
<p>By recompile I meant that it would discard the .rlib file and recompile from source because it thinks the .rlib file is invalid, how does that work and happen?</p>



<a name="226054334"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226054334" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226054334">(Feb 11 2021 at 20:40)</a>:</h4>
<p>that's probably cargo doing that but I'm not sure without seeing your build output</p>



<a name="226054574"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226054574" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Leo Le Bouter <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226054574">(Feb 11 2021 at 20:42)</a>:</h4>
<p>OK, well I don't have any in particular, I will collaborate with my rusty peers over at GNU Guix on this and report back. Thanks everyone for fruitful discussion with so many people.</p>



<a name="226054600"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226054600" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226054600">(Feb 11 2021 at 20:42)</a>:</h4>
<p>To me it sounds like you want to forgo cargo entirely, to be honest.</p>



<a name="226054645"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226054645" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226054645">(Feb 11 2021 at 20:43)</a>:</h4>
<p>especially given the fact that you'll be building majority of crates with all their features enabled.</p>



<a name="226054687"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226054687" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226054687">(Feb 11 2021 at 20:43)</a>:</h4>
<p>in that context all cargo provides you is interpreting <code>build.rs</code> output and adding the <code>--extern dep=loc.rlib</code> flags to a rustc invocation.</p>



<a name="226054834"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226054834" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226054834">(Feb 11 2021 at 20:44)</a>:</h4>
<p>in theory it would even trivially allow you to use the <code>--crate-type=dylib</code> and link things dynamically for space &amp; memory savings.</p>



<a name="226055241"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse/near/226055241" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Leo Le Bouter <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rlib-intermediate-object-reuse.html#226055241">(Feb 11 2021 at 20:48)</a>:</h4>
<p><span class="user-mention" data-user-id="123586">@nagisa</span> I would really love to be able to do that, I am a bit hesitant because Cargo is huge</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>